package com.结构型模型.K外观模式;

public class SmartAppliancesFacade {
    private Light light;
    private TV tv;
    private AirCondition airCondition;

    public SmartAppliancesFacade() {
        this.light=new Light();
        this.tv=new TV();
        this.airCondition=new AirCondition();

    }

    public void say(String msg){
        if (msg.contains("打开")){
            on();
        }else if(msg.contains("关闭")){
            off();
        }else {
            System.out.println("听不懂你说啥……");
        }

    }

    public void on(){
        tv.on();
        light.on();
        airCondition.on();
    }

    public void off(){
        tv.off();
        light.off();
        airCondition.off();
    }

}
